package com.up360.rapidcalc.aerolite.dao
{
    import com.up360.rapidcalc.aerolite.model.Subject;

    /**
     * @author Tunie
     * @date   May 2, 2013
     */
    public class SubjectDao
    {
        public function SubjectDao()
        {
        }
        
        public static function newInstance(data:Object):Subject
        {
            var b_subject:Subject=new Subject();
            b_subject.topic=data.topic;
            
            var b_answers:Array=data.answers as Array;
            var b_length:int=b_answers.length;
            for(var i:int=0;i<b_length;i++)
            {
                b_answers.push(AnswerDao.newInstance(b_answers[i]));
            }
            b_answers.splice(0,b_length);
            
            b_subject.answers=b_answers;
            return b_subject;
        }
    }
}